clear
%cd ('W:\Projects\Hoffmann_Shcherbakova\Programs_RES')
format('bank');

%%Table 1 
display('     Table 1: Risk Sharing and Business Cycle')
display('               Panel A 1964-1984')
disp('  ')

state_group='all';
s=1; %the 1st year in the data, the first year in this specification(1964) 
T=21; %the 21st year in the data, the last year for this specification (1984)

Main_preparation

M=[ones(size(dgsp)),dy(s:s+T-1,1:K)];%gdp bea only
NL=[];
 
%estimator='OLS';

 if ~exist('estimator')
     estimator='OLS';
 end
 
 if ~exist('channel')
     channel='all';
 end
Main
 
display('                 Panel A 1985-2005')
disp('  ')

s=22;%the 22nd year in the data, the first year in this specification(1985) 
T=42;%the last year in the data, the last year in this specification(2005)

Main_preparation
M=[ones(size(dgsp)),dy(s:s+T-1,1:K)];%gdp bea only 
Main

display('                   Panel B 1964-1984')
disp('  ')

s=1;
T=21;

Main_preparation
M=[ones(size(dgsp)),NBERPeak(s+1:s+T,:)*ones(1,K),NBERTrough(s+1:s+T,:)*ones(1,K)];
Main

varI=IAR_Cl.ClusterReg{1}(:,4:end);
varF=IAR_Cl.ClusterReg{2}(:,4:end);
varC=IAR_Cl.ClusterReg{3}(:,4:end);
varU=IAR_Cl.ClusterReg{4}(:,4:end);
[FtestI,DI,PValI]=Ftest(IAR_Cl.b(:,1),[0,0,1,1],varI,size(Y_channels,1),0);%ich hatte aus versehen
[FtestF,DF,PValF]=Ftest(IAR_Cl.b(:,2),[0,0,1,1],varF,size(Y_channels,1),0);%IAR_Cl.b(:,4)
[FtestC,DC,PValC]=Ftest(IAR_Cl.b(:,3),[0,0,1,1],varC,size(Y_channels,1),0);% f�r jede beta
[FtestU,DU,PValU]=Ftest(IAR_Cl.b(:,4),[0,0,1,1],varU,size(Y_channels,1),0);%gehabt
Ftest=[FtestI,FtestF,FtestC,FtestU];
PVal=[PValI,PValF,PValC,PValU];

display('                           Panel B 1985-2005')
disp('  ')

s=22;
T=42;

Main_preparation
M=[ones(size(dgsp)),NBERPeak(s+1:s+T,:)*ones(1,K),NBERTrough(s+1:s+T,:)*ones(1,K)];
Main

display('F-Test of H0: Symmetry of expansion and recession (1964-1984)')
display(Ftest)
display(PVal)




